<template>
  <!-- 提示需要登录 -->
  <el-dialog
    title="请登录"
    :visible.sync="dialogNeedLogin"
    :center="true"
    width="300px">
    <p class="xui-text-center">您需要登录后才能进行下一步操作。</p>
    <span slot="footer" class="dialog-footer">
      <!-- <el-button @click="dialogNeedLogin = false">取 消</el-button> -->
      <el-button type="primary" @click="showLogin">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  computed: {
    dialogNeedLogin: {
      get: function() {
        return this.$store.state.user.dialogNeedLogin;
      },
      set: function(newValue) {
        this.$store.dispatch("ToggleNeedLogin", newValue);
      }
    }
  },
  methods: {
    handleClose(done) {
      this.$store.dispatch("ToggleLoginDialog", true);
      done();
    },
    showLogin() {
      this.dialogNeedLogin = false;
      this.$store.dispatch("ToggleLoginDialog", true);
    }
  }
};
</script>

